package edu.sandau.b230151.b23015122.service;

import edu.sandau.b230151.b23015122.repository.BookRepository;
import edu.sandau.b230151.b23015122.Model.Book;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class BookService {
    @Autowired
    private BookRepository bookRepository;
    public List<Book> findAll(Book book){
        return bookRepository.findAll();
    }
    public void deleteById(int id){
        bookRepository.deleteById(Integer.valueOf(String.valueOf(id)));
    }
    public void save(Book s){
        bookRepository.save(s);
    }
    public Book getReferenceById(int id){
        return bookRepository.getReferenceById(id);
    }
}


//demo-0.0.1-SNAPSHOT.jar